package com.yihaodian.search.highlight;

import com.yihaodian.api.search.SearchException;
import com.yihaodian.api.search.misc.SearchHit;
import com.yihaodian.search.SearchContext;
import com.yihaodian.search.SearchPhase;

public class HighlightPhase implements SearchPhase {
	HighlightHandler highlightHandler;

	@Override
	public void execute(SearchContext context) throws SearchException {
		SearchHit[] hits = context.getFetchResult().getHits();
		for (int i = 0; i < hits.length; i++) {
			HighlightHandler.highlight(context.getSearcher().reader(), 
					hits[i], context.getQuery(), context.getShardRequest().getSearchRequest().getHighlightSpecs());
		}
		

	}

}
